{% extends "template/listEdit.volt" %}

{% block title %}用户管理{% endblock %}


{% block filter %}
    <div class="col-md-4 col-sm-6 col-xs-12">
        <table>
            <tr>
                <th>钥匙id:</th>
                <input type="hidden" id="id" name="id" value="">
                <td><input type="text" id="key_id" name="key_id" value=""></td>
            </tr>
            <tr>
                <td colspan="2">
                    <div id="btn_reset_param" class="btn-0 button">重 置</div>
                    <div id="btn_search_data" class="btn-1 button">过 滤</div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div id="btn_unbind" class="btn-1 button" onClick="actionUnbind()">解绑</div>
                </td>
            </tr>
        </table>
    </div>
{% endblock %}

{% block hiddenOperation %}hidden{% endblock %}

{% block jscontent %}
    <script>
        function actionUnbind() {
            var result = confirm("您确定解绑该记录?");
            if (result) {
                $.post("/plane/doKeyUnbind", {
                    "key_id": $('#key_id').val()
                }, function (result) {
                	if(result.status == 0){
	                	$('#id').val(result.data);
	                    PageDataProxy.refresh();
	                    FAlert(result.message, function (result) { }) 
                	}else{
	                    FAlert(result.message, function (result) { }) 
                	}
                });
            }
        }

        $(function () {
            PageDataProxy.init({
                "url": "/plane/keyUnbind",
                "table_id": "#mytable",
                "page_control_id": "#data-wrap",
                "page_size_id": "#rows-perpage-select",
                "page_total_id": "#data_count_total",
                "use_check_box": false,
                "data_field_process": function (name, value) {
                    return value;
                },
                "table_style": {
                    "id": "width-s",
                    "name": "width-m",
                    "uas_serial_id": "width-m",
                    "planeModel_id": "width-m",
                    "key_id": "width-m",
                    "phone": "width-m"
                },
                "data_field_action_process": function (tag) {
                    return "<td onclick=clickUnbind(" + tag + ")><img class='action-show-icon'>解绑</td>";
                }
            });
        })
        
        function clickUnbind(id){
            var result = confirm("您确定解绑该记录?");
            if (result) {
	            feimaPost("/plane/keyUnbindById",{
	                "id":id
	            },function(result){
	                    FAlert(result.message);
	                    PageDataProxy.refresh();
	            });
            }
        }
    </script>
{% endblock %}